package com.sansec.demo.interfaces.facade;

import com.alibaba.fastjson.JSON;
import com.sansec.demo.Infrastructure.feigninterface.FeignProduceInterface;
import com.sansec.demo.interfaces.dto.UserDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lichangwei
 */
@RestController
@RequestMapping(value = "/feign")
public class FeignConsumerController {

    @Autowired
    FeignProduceInterface feignProduceInterface;

    @RequestMapping(value = "/getuser",method = RequestMethod.GET)
    public String getUser(){
        UserDTO user = feignProduceInterface.getUser();
        return JSON.toJSONString(user);
    }
}
